/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.jr2tecnologia.model.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author ronildo
 */
@Entity
@Table(name = "sms_send")
@NamedQueries({
    @NamedQuery(name = "SmsSend.findAll", query = "SELECT s FROM SmsSend s"),
    @NamedQuery(name = "SmsSend.findByPkSmsSend", query = "SELECT s FROM SmsSend s WHERE s.pkSmsSend = :pkSmsSend"),
    @NamedQuery(name = "SmsSend.findByMessage", query = "SELECT s FROM SmsSend s WHERE s.message = :message"),
    @NamedQuery(name = "SmsSend.findByStatus", query = "SELECT s FROM SmsSend s WHERE s.status = :status"),
    @NamedQuery(name = "SmsSend.findByDatetimeRegistered", query = "SELECT s FROM SmsSend s WHERE s.datetimeRegistered = :datetimeRegistered"),
    @NamedQuery(name = "SmsSend.findByDatetimeSent", query = "SELECT s FROM SmsSend s WHERE s.datetimeSent = :datetimeSent"),
    @NamedQuery(name = "SmsSend.findByNowSmsId", query = "SELECT s FROM SmsSend s WHERE s.nowSmsId = :nowSmsId"),
    @NamedQuery(name = "SmsSend.findByDelivered", query = "SELECT s FROM SmsSend s WHERE s.delivered = :delivered")})
public class SmsSend implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "pk_sms_send")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_sms_send")
    @SequenceGenerator(name="seq_sms_send", sequenceName="seq_sms_send", allocationSize=1)
    private Long pkSmsSend;

    @Basic(optional = false)
    @Column(name = "message")
    private String message;

    @Basic(optional = false)
    @Column(name = "status")
    private String status;

    @Basic(optional = false)
    @Column(name = "datetime_registered")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetimeRegistered;

    @Column(name = "datetime_sent")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetimeSent;

    @Column(name = "now_sms_id")
    private String nowSmsId;

    @Basic(optional = false)
    @Column(name = "delivered")
    private boolean delivered;

    @JoinColumn(name = "fk_modem", referencedColumnName = "pk_modem")
    @ManyToOne
    private Modem modem;

    @JoinColumn(name = "fk_login", referencedColumnName = "pk_login")
    @ManyToOne(optional = false)
    private Login login;

    @JoinColumn(name = "fk_client_phone", referencedColumnName = "pk_client_phone")
    @ManyToOne(optional = false)
    private ClientPhone clientPhone;

    @JoinColumn(name = "fk_carrier", referencedColumnName = "pk_carrier")
    @ManyToOne(optional = false)
    private Carrier carrier;

    @Transient
    private int quantity;

    public SmsSend() {
    }

    public SmsSend(Long pkSmsSend) {
        this.pkSmsSend = pkSmsSend;
    }

    public SmsSend(Login login) {
        this.login = login;
    }

    public SmsSend(Modem modem) {
        this.modem = modem;
    }

    public SmsSend(Long pkSmsSend, String message, String status, Date datetimeRegistered, boolean delivered) {
        this.pkSmsSend = pkSmsSend;
        this.message = message;
        this.status = status;
        this.datetimeRegistered = datetimeRegistered;
        this.delivered = delivered;
    }

    public Long getPkSmsSend() {
        return pkSmsSend;
    }

    public void setPkSmsSend(Long pkSmsSend) {
        this.pkSmsSend = pkSmsSend;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getDatetimeRegistered() {
        return datetimeRegistered;
    }

    public void setDatetimeRegistered(Date datetimeRegistered) {
        this.datetimeRegistered = datetimeRegistered;
    }

    public Date getDatetimeSent() {
        return datetimeSent;
    }

    public void setDatetimeSent(Date datetimeSent) {
        this.datetimeSent = datetimeSent;
    }

    public String getNowSmsId() {
        return nowSmsId;
    }

    public void setNowSmsId(String nowSmsId) {
        this.nowSmsId = nowSmsId;
    }

    public boolean getDelivered() {
        return delivered;
    }

    public void setDelivered(boolean delivered) {
        this.delivered = delivered;
    }

    public Modem getModem() {
        return modem;
    }

    public void setModem(Modem modem) {
        this.modem = modem;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public ClientPhone getClientPhone() {
        return clientPhone;
    }

    public void setClientPhone(ClientPhone clientPhone) {
        this.clientPhone = clientPhone;
    }

    public Carrier getCarrier() {
        return carrier;
    }

    public void setCarrier(Carrier carrier) {
        this.carrier = carrier;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pkSmsSend != null ? pkSmsSend.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SmsSend)) {
            return false;
        }
        SmsSend other = (SmsSend) object;
        if ((this.pkSmsSend == null && other.pkSmsSend != null) || (this.pkSmsSend != null && !this.pkSmsSend.equals(other.pkSmsSend))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.jr2tecnologia.model.entity.SmsSend[pkSmsSend=" + pkSmsSend + "]";
    }

}
